#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message.  The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit.  The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".

# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"

# This example catches duplicate Signed-off-by lines.

test "" = "$(grep '^Signed-off-by: ' "$1" |
	 sort | uniq -c | sed -e '/^[ 	]*1[ 	]/d')" || {
	echo >&2 Duplicate Signed-off-by lines.
	exit 1
}

#!/bin/sh
COMMIT_MSG_FILE=$1
msg=$(cat $COMMIT_MSG_FILE)
if ! [[ $msg =~ ^(feat|fix|docs|style|refactor|test|chore|perf|ci):.* ]]; then
    echo "提交消息应遵循格式如 (feat|fix|docs|style|refactor|test|chore|perf|ci): 具体描述。"
    echo "feat		增加新功能"
    echo "fix		修复bug"
    echo "docs		修改文档"
    echo "style		修改代码格式，不影响代码逻辑"
    echo "refactor	重构代码,没有加新功能或修复bug"
    echo "test		增加测试用例"
    echo "chore		构建过程或辅助工具的变动，如依赖管理、构建脚本、文档生成等"
    echo "perf		提升性能"
    echo "ci		持续集成相关的改动，如 Travis、Jenkins 等"
    exit 1
fi




MSG=`awk '{printf("%s",$0)}' $1`

	# 获取当前项目路径
REPO_PATH=GIT_DIR
	# 打印项目路径
echo $PWD
echo $hooksPath
echo "-----------"
echo "只有${#MSG}字符${MSG}"
#echo "message的长度不能小于5, 本次提交失败，请完善commit message，再提交"
echo "-----------"
#./.githooks/py.py ${MSG}
gitsql.exe "$PWD" ${MSG}
exit 0; #如果该钩子脚本以非零值退出，Git 将放弃提交
	



